package com.onairm.baselibrary.tv;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by apple on 17/5/25.
 *
 * RecyclerView item 的间距
 */

public class SpaceItemDecoration extends RecyclerView.ItemDecoration {
    private int mSpaceTop,mSpaceBottom,mSpaceLeft,mSpaceRight;
    public SpaceItemDecoration(int spaceTop, int spaceBottom, int spaceLeft, int spaceRight) {
        mSpaceTop=spaceTop;
        mSpaceBottom=spaceBottom;
        mSpaceLeft=spaceLeft;
        mSpaceRight=spaceRight;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
        super.getItemOffsets(outRect, view, parent, state);
        outRect.bottom=mSpaceBottom;
        outRect.top=mSpaceTop;
        outRect.left=mSpaceLeft;
        outRect.right=mSpaceRight;
    }
}
